// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ITraceSwitchProvider.cs" company="AzureContrib (Open source library http://azurecontrib.codeplex.com)">
//   Microsoft Public License (Ms-PL)
// </copyright>
// <summary>
//   Provides <see cref="TraceSwitch"/> for implementations that are <see cref="ITraceSwitchable"/>.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System;

namespace AzureContrib.WindowsAzure.Diagnostics
{
	/// <summary>
	/// Provides <see cref="TraceSwitch"/> for implementations that are <see cref="ITraceSwitchable"/>.
	/// </summary>
	public interface ITraceSwitchProvider
	{
		/// <summary>
		/// Find the <see cref="TraceSwitch"/> for this <see cref="ITraceSwitchable"/>?
		/// </summary>
		/// <param name="traceSwitchable">The <see cref="ITraceSwitchable"/> to find a <see cref="TraceSwitch"/> for.</param>
		/// <returns>The <see cref="TraceSwitch"/> to use.</returns>
		TraceSwitch GetSwitch(ITraceSwitchable traceSwitchable);

		/// <summary>
		/// Check if logging is enabled for <paramref name="traceSwitchable"/> on the <paramref name="logLevel"/>.
		/// </summary>
		/// <param name="logLevel">The level to control logging for.</param>
		/// <param name="traceSwitchable">The <see cref="ITraceSwitchable"/> to check for enablement.</param>
		/// <returns>True if logging is enabled.</returns>
		bool Enabled(LogLevel logLevel, ITraceSwitchable traceSwitchable);
	}
}